<?php
/**
 * @package Gantry Template Framework - RocketTheme
 * @version 3.2.2 April 1, 2011
 * @author RocketTheme http://www.rockettheme.com
 * @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 *
 * Gantry uses the Joomla Framework (http://www.joomla.org), a GNU/GPLv2 content management system
 *
 */
// no direct access
defined( '_JEXEC' ) or die( 'Restricted index access' );

// load and inititialize gantry class
require_once('lib/gantry/gantry.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $gantry->language; ?>" lang="<?php echo $gantry->language;?>" >
<head>

<script>
	var urlWebsite = '<?=JURI::base();?>';
</script>

<?php

/* EDAZCOMMERCE - PEGA O NOME DA PÁGINA ATUAL */
$arrayRequestURI = explode("/", $_SERVER['REQUEST_URI']);
$paginaAtual	 = (count($arrayRequestURI) > 0) ? $arrayRequestURI[count($arrayRequestURI)-1] : '';

/* VERIFICA DE A URL POSSUI PARÂMETROS */
if(strrpos($paginaAtual, '?')){
	$posicaoInicioParametros = strrpos($paginaAtual, '?');
	$parametrosUrl	 = substr($paginaAtual, $posicaoInicioParametros+1, strlen($paginaAtual));
	$paginaAtual	 = substr($paginaAtual, 0, $posicaoInicioParametros);
	
	/* CRIANDO ARRAY DOS PARAMETROS */
	$arrayParametrosGeral = array();
	$arrayParametrosTemp  = explode("&", $parametrosUrl);
	foreach($arrayParametrosTemp as $parValor){
		$posDivisor = strpos($parValor, '=');
		$atributo   = substr($parValor, 0, $posDivisor);
		$valor	    = substr($parValor, $posDivisor+1, strlen($parValor));
		
		$arrayParametrosGeral[$atributo] = $valor;
	}
}

$gantry->displayHead();
$gantry->addStyles(array('template.css','joomla.css','style.css'));
$doc =& JFactory::getDocument();
$doc->addScript(JURI::base()."templates/".$this->template."/js/jscolor/jscolor.js");
$doc->addScript(JURI::base()."templates/".$this->template."/js/custom.js");
$doc->addScript(JURI::base()."templates/".$this->template."/js/jquery-1.7.1.js");
$doc->addScript(JURI::base()."templates/".$this->template."/js/edazcommerce.js");
$doc->addScript(JURI::base()."templates/".$this->template."/js/jquery.maskedinput-1.1.4.pack.js");
			
$menus = JSite::getMenu();
$active = $menus->getActive();
$default = $menus->getDefault();

$isHomepage = 0;
if (is_object($active)) {
	$params = new JParameter($active->params);
	$pageclass = $params->get('pageclass_sfx');
	if($pageclass == 'homepage') {
		$isHomepage = 1;
	}
}


$homepage = 0;
if($active->id == $default->id) {
	$homepage = 1;	
}
?>

<!--Start of Zopim Live Chat Script-->
<script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8');
$.src='//cdn.zopim.com/?lFixaFNBYShdw0FG1Yk5AXQ9oIF70KtO';z.t=+new Date;$.
type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
</script>
<!--End of Zopim Live Chat Script-->

</head>
<body <?php echo $gantry->displayBodyTag(); ?>>

<?php
// check if homepage
//if($active->id == $default->id) {
// check if demo color panel is enabled
if($gantry->get('demopanel') == 1) { ?>
<script src="<?php echo JURI::base()."templates/".$this->template; ?>/js/demopanel.js" type="text/javascript"></script>
<?php
if(isset($_POST['changecolor'])) {
	$maincolor = $_POST['jscolorInput'];
	$bottomcolor = $_POST['jscolorInput3'];
echo '
<style type="text/css">
#bg-top, #gantry-totop, .nspPagination li:hover, .nspPagination li.active, .findoutmore a, #rt-mainbottom h2.title span, a.readmore  {background-color:#'.$maincolor.'}
.hometitle h3, #rt-footer a {color:#'.$maincolor.'}
#rt-bottom {background-color:#'.$bottomcolor.'}
</style>
';
	
} else {
?>
<div id="jscolor">
	<div class="jswrapper">
	<a href="#" id="btn"></a>
	<form name="form-color" action="" method="post" >
        <p class="note" style="padding-top:10px;"><strong>Click the fields to edit color</strong></p>
        <p><label for="jscolorInput">Main color</label>
        <input class="color {pickerPosition:'right'}" value="00A3D3" id="jscolorInput" name="jscolorInput" type="text" /></p>
        <p><label for="jscolorInput3">Bottom color</label>
        <input class="color {pickerPosition:'right'}" value="00A3D3" id="jscolorInput3" name="jscolorInput3" type="text" /></p>
        
        <p class="note">Some of the elements colors cannot be applied with javascript, so we included a button which will apply the styles for each element in this demo</p>
        <p><input type="submit" name="changecolor" value="apply the colors" /></p>
        <p class="note">Change pattern:</p>
        <ul>
        	<li class="nobg"></li>
        <?php
		for($i = 1; $i <= 19; $i++) {
			echo '<li class="ptn-'.$i.'" title="ptn-'.$i.'"></li>';
		}
		?>
        </ul>
        <div class="clear"></div>
        <span class="hide">[ hide this panel ]</span>
    </form>
    </div>
</div>
<?php 	} // end else
	} // end if enabled
//} // end if frontpage
?>

   		<?php

		// just for demo
		if($gantry->get('demopanel') == 1) {
			if($homepage == 1) {
				//echo '<div id="click_us"></div>';
			}
		}
		?>
		
        <?php /** Begin Drawer **/ if ($gantry->countModules('drawer')) : ?>
        <div id="rt-drawer">
            <div class="rt-container">
                <?php echo $gantry->displayModules('drawer','standard','standard'); ?>
                <div class="clear"></div>
            </div>
        </div>
        <?php /** End Drawer **/ endif; ?>
		<?php /** Begin Top **/ if ($gantry->countModules('top')) : ?>
		<div id="rt-top" <?php echo $gantry->displayClassesByTag('rt-top'); ?>>
			<div class="rt-container">
				<?php echo $gantry->displayModules('top','standard','standard'); ?>
                
				<div class="clear"></div>
			</div>
            <div id="closeTop">Fechar</div>
		</div>
		<?php /** End Top **/ endif; ?>
        
	<div class="main-wrapper">
    	<div id="bg-top">
        	<div class="top1"></div>
           	<div class="top2"></div>
            <div id="overlay" class="<?php echo $gantry->get('pattern'); ?>"></div>
        </div>
        <?php /** Begin Logo **/ if ($gantry->countModules('logo')) : ?>
        <div id="logo">
        	<?php echo $gantry->displayModules('logo','basic','basic'); ?>
        </div>
        <?php /** End Logo **/ endif; ?>
        
		<?php /** Begin Header **/ if ($gantry->countModules('header')) : ?>
		<div id="rt-header">
			<div class="rt-container">
				<?php echo $gantry->displayModules('header','standard','standard'); ?>
				<div class="clear"></div>
			</div>
		</div>
		<?php /** End Header **/ endif; ?>
        
        <?php /** Begin Menu **/ if ($gantry->countModules('navigation')) : ?>
        <div id="rt-menu">
	        <div class="rt-container">
				<?php echo $gantry->displayModules('navigation','basic','basic'); ?>
				<div class="clear"></div>
			</div>
        </div>
		<?php /** End Menu **/ endif; ?>
		
		<div id="rt-showcase">
			<div class="rt-container">
                <?php /** Begin Showcase **/ if ($gantry->countModules('showcase')) { ?>
				<?php echo $gantry->displayModules('showcase','basic','standard'); ?>
				<div class="clear"></div>
                <?php /** End Showcase **/ 
				} else {
					if($active->note) {
						echo '<div class="rt-block"><div class="pageheader">'.$active->note.'</div></div>';	
					} else {
						echo '<div class="rt-block"></div>';	
					}
				}
				 ?>
			</div>
		</div>
		<?php
		if($homepage == 0 && $isHomepage == 0) {
		/** Begin Breadcrumbs **/ if ($gantry->countModules('breadcrumb')) : ?>
		<div id="rt-breadcrumbs">
			<div class="rt-container">
				<?php echo $gantry->displayModules('breadcrumb','standard','standard'); ?>
				<div class="clear"></div>
			</div>
		</div>
		<?php /** End Breadcrumbs **/ endif;
		}
		?>
		<?php /** Begin Feature **/ if ($gantry->countModules('feature')) : ?>
		<div id="rt-feature">
			<div class="rt-container">
				<?php echo $gantry->displayModules('feature','standard','standard'); ?>
				<div class="clear"></div>
                <div class="block-separator"></div>
			</div>
		</div>
		<?php /** End Feature **/ endif; ?>
        
        <?php /** Begin System Messages **/ if ($gantry->countModules('sysmessages')) : ?>
		<div id="rt-sysmessages">
			<div class="rt-container">
				<?php echo $gantry->displayModules('sysmessages','standard','standard'); ?>
				<div class="clear"></div>
			</div>
		</div>
		<?php /** End System Messages **/ endif; ?>
		
		<?php /** Begin Main Top **/ if ($gantry->countModules('maintop')) : ?>
		<div id="rt-maintop">
			<div class="rt-container">
				<?php echo $gantry->displayModules('maintop','standard','standard'); ?>
				<div class="clear"></div>
			</div>
		</div>
		<?php /** End Main Top **/ endif; ?>
		<?php /** Begin Main Body **/ ?>
	    <?php echo $gantry->displayMainbody('mainbody','sidebar','standard','standard','standard','standard','standard'); ?>
		<?php /** End Main Body **/ ?>
		
		<? if($isHomepage): ?>
			<div id="linksInstitucionaisHome">
				<div class="rt-container">
					<div class="linksUteis">Links Úteis</div>
					<div class="rt-grid-5 padding40">
						<div class="receitaFederal"></div>
					</div>
	        		<div class="rt-grid-5 padding40">
						<div class="parceirosDiv"></div>
					</div>
		        </div>
		    </div>
		<? endif; ?>
		
		<?php /** Begin Main Bottom **/ if ($gantry->countModules('mainbottom')) : ?>
		<div id="rt-mainbottom">
			<div class="rt-container">
            	<div class="rt-container-inline">
				<?php echo $gantry->displayModules('mainbottom','standard','standard'); ?>
				<div class="clear"></div>
                </div>
			</div>
		</div>
		<?php /** End Main Bottom **/ endif; ?>
        <?php /** Begin Utility **/ if ($gantry->countModules('utility')) : ?>
		<div id="rt-utility">
			<div class="rt-container">
				<?php echo $gantry->displayModules('utility','standard','standard'); ?>
				<div class="clear"></div>
			</div>
		</div>
		<?php /** End Utility **/ endif; ?>
        
		<?php /** Begin Bottom **/ if ($gantry->countModules('bottom')) : ?>
		<div id="rt-bottom">
        	<div class="ptn-4">
            <div class="rt-glow">
        	<div class="rt-wrapper">
                <div class="rt-container">
                    <?php echo $gantry->displayModules('bottom','standard','standard'); ?>
                    <!-- FACEBOOK - FOOTER -->
                    <div class="rt-grid-4 rt-omega">
                    	<div class="wrapperFaceBookFooterDiv" style="display: none;">
							<iframe scrolling="no" frameborder="0" allowtransparency="true" width="300" height="180" style="border-bottom: 0px solid #ababab; margin-left: -1px; overflow: auto;" src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FFragatta-Log%25C3%25ADstica%2F299533280161932%3Fref%3Dhl&amp;width=310&amp;height=183&amp;colorscheme=light&amp;show_faces=true&amp;border_color=silver&amp;stream=false&amp;header=false"></iframe>
						</div>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>
            </div>
            </div>
		</div>
		<?php /** End Bottom **/ endif; ?>
		<?php /** Begin Footer **/ if ($gantry->countModules('footer')) : ?>
		<div id="rt-footer">
        	<div class="rt-glow">
			<div class="rt-container">
				<?php echo $gantry->displayModules('footer','standard','standard'); ?>
				<div class="clear"></div>
			</div>
            </div>
		</div>
		<?php /** End Footer **/ endif; ?>
		<?php /** Begin Copyright **/ if ($gantry->countModules('copyright')) : ?>
		<div id="rt-copyright">
			<div class="rt-container">
				<?php echo $gantry->displayModules('copyright','standard','standard'); ?>
				<div class="clear"></div>
			</div>
		</div>
		<?php /** End Copyright **/ endif; ?>
		<?php /** Begin Debug **/ if ($gantry->countModules('debug')) : ?>
		<div id="rt-debug">
			<div class="rt-container">
				<?php echo $gantry->displayModules('debug','standard','standard'); ?>
				<div class="clear"></div>
			</div>
		</div>
		<?php /** End Debug **/ endif; ?>
		<?php /** Begin Analytics **/ if ($gantry->countModules('analytics')) : ?>
		<?php echo $gantry->displayModules('analytics','basic','basic'); ?>
		<?php /** End Analytics **/ endif; ?>
        </div>
	</body>
</html>
<?php
$gantry->finalize();
?>

<script>
<?
/* EDAZCOMMERCE - AJUSTES FINAIS LAYOUT */
switch($paginaAtual){
	case 'contato-site':
		echo " jQ('#rt-showcase .rt-block').css('height', '70px'); ";
		if(isset($arrayParametrosGeral['tipoLink'])){
			echo " jQ('#form-logistica').val('".$arrayParametrosGeral['tipoLink']."'); ";
		}
		break;
	case 'noticias':
		echo " jQ('img').addClass('imagemBordaArredondada5'); ";
		break;
	case 'profile':
		echo " jQ('.profile a').addClass('readmore'); ";
		break;
}
?>
</script>